/**
 * Created by zdx on 2016/8/26 0026.
 */

/*
module.exports = function (grunt) {

    grunt.initConfig({
        connect: {
            server: {
                options: {
                    port: 8000,
                    hostname: '*',
                    base: './build',
                    open: true,
                    livereload: true
                }
            }
        },
        less: {
            lessall: {
                files: [{
                    expand:true,
                    cwd:'src',
                    src:'style/!**!/!*.less',
                    dest: 'build/',
                    ext: '.min.css'
                }],
                options: {
                    compress: true
                }
            }
        },
        copy: {
            main: {
                files: [
                    {
                        expand: true,
                        cwd: 'src',
                        src: ['style/!**!/!*.css', 'script/!**!/!*', 'pages/!**!/!*'],
                        dest: 'build/'
                    }
                ]
            },
            css: {
                files: [
                    {
                        expand: true,
                        cwd: 'src',
                        src: ['style/!**!/!*.css', 'script/!**!/!*.css'],
                        dest: 'build/'
                    }
                ]
            },
            js: {
                files: [
                    {
                        expand: true,
                        cwd: 'src',
                        src: ['script/!**!/!*.js'],
                        dest: 'build/'
                    }
                ]
            },
            html: {
                files: [
                    {
                        expand: true,
                        cwd: 'src',
                        src: ['pages/!**!/!*.html'],
                        dest: 'build/'
                    }
                ]
            }
        },
        watch: {
            lesstocss: {
                files: ['src/!**!/!*.less', 'src/!**!/!*.css'],
                tasks: ['less', 'copy:css'],
                options: {
                    livereload: true
                }
            },
            buildJs: {
                files: ['src/!**!/!*.js'],
                tasks: ['copy:js'],
                options: {
                    livereload: true
                }
            },
            buildHtml: {
                files: ['src/!**!/!*.html'],
                tasks: ['copy:html'],
                options: {
                    livereload: true
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.registerTask('default', ['less', 'copy:main']);
    grunt.registerTask('serve', ['connect','watch' ]);
};*/

module.exports = function (grunt) {

    grunt.initConfig({
        less: {
            /*compile: {
             files: {
             'css/styles/test.css': 'css/less/test.less'
             }
             },*/
            /*compress: {
             files: {
             'css/styles/test-min.css': 'css/styles/test.css'
             },
             options: {
             compress: true
             }
             }*/
            lessall: {
                files: [{
                    expand:true,
                    cwd:'src/style',
                    src:'*.less',
                    dest: 'src/style/',
                    ext: '.min.css'
                }],
                options: {
                    compress: true
                }
            }
        },
        /*
         jshint: {
         all: [
         'scripts/!**!/!*.js'
         ],
         options: {
         browser: true,            // browser environment
         devel: true                //
         }
         },*/
        watch: {
            lesstocss: {
                files: ['src/style/*.less'],
                tasks: ['less']
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-watch');
    /*grunt.loadNpmTasks('grunt-contrib-jshint');*/

    grunt.registerTask('default', ['less','watch']);
};